name: Build QA - Out-of-tree build



on:
  workflow_dispatch:

  pull_request:
    branches:
      - master
    paths-ignore:
      - '.github/**'
      - '.gitignore'
      - 'ChangeLog'
      - 'COPYING'
      - 'configure.scan'
      - 'packaging/**'
      - 'dev-tools/**'
      - '!dev-tools/libexec/get-release-*.sh'
      - 'doc/**'
      - 'etc/**'
      - 'install/**'
      - 'lib/*/IMPORT.defs'
      - 'lib/*/LICENSE'
      - 'README.md'

  push:
    branches:
      - master
    tags:
      - '*'
    paths-ignore:
      - '.github/**'
      - '.gitignore'
      - 'ChangeLog'
      - 'COPYING'
      - 'configure.scan'
      - 'packaging/**'
      - 'dev-tools/**'
      - '!dev-tools/libexec/get-release-*.sh'
      - 'doc/**'
      - 'etc/**'
      - 'install/**'
      - 'lib/*/IMPORT.defs'
      - 'lib/*/LICENSE'
      - 'README.md'



jobs:
  build-qa-out-of-tree-build:

    name: Out-of-tree build
    runs-on: ubuntu-20.04
    container: ciready/ubuntu:20.04-ci-c



    ###
    ### Steps to run
    ###
    steps:



      ### Fetch the code
      #
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0

      # Work around the fix for CVE-2022-24765
      - run: git config --global --add safe.directory $GITHUB_WORKSPACE || true



      ### Build
      #
      - run: ./dev-tools/install-dev-software.sh
      - run: ./bootstrap.sh
      - run: mkdir -p tmp/build1
      - run: cd tmp/build1 && ../../configure --enable-option-checking=fatal --enable-everything
      - run: cd tmp/build1 && make -j4
      - run: cd tmp/build1 && make -j4 check

      - run: cat tmp/build1/tests/*/test-suite.log
        if: failure()
